package com.comum.javahomework420242025.mapper;

import com.comum.javahomework420242025.pojo.ClientCome;
import com.comum.javahomework420242025.pojo.ClientComeForResult;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ClientComeMapper {
    @Select("select *, clientcompany.clientcompanyname as clientname from clientcome join clientcompany on " +
            "clientcome.clientcompanyid=clientcompany.id " +
            "where clientcome.clientcompanyid like concat('%',concat(#{str},'%')) or " +
            "clientcompany.clientcompanyname like concat('%',concat(#{str},'%')) or " +
            "clientcome.status like concat('%',concat(#{str},'%')) or " +
            "clientcome.comedate like concat('%',concat(#{str},'%')) or " +
            "clientcome.comment like concat('%',concat(#{str},'%'))")
    List<ClientComeForResult> listpart(String str);

    @Select("select *, clientcompany.clientcompanyname as clientname from clientcome join clientcompany on " +
            "clientcome.clientcompanyid=clientcompany.id " +
            "where clientcome.clientcompanyid=#{clientcompanyid} and (clientcome.clientcompanyid like concat('%',concat(#{str},'%')) or " +
            "clientcompany.clientcompanyname like concat('%',concat(#{str},'%')) or " +
            "clientcome.status like concat('%',concat(#{str},'%')) or " +
            "clientcome.comedate like concat('%',concat(#{str},'%')) or " +
            "clientcome.comment like concat('%',concat(#{str},'%')))")
    List<ClientComeForResult> getClientsComesByClientCompanyid(String str, String clientcompanyid);
}
